1. Field of the Invention
The present invention relates to a semiconductor memory device, for example, a semiconductor memory device for storing encoded data obtained by encoding input data for error connection at the time of writing in a nonvolatile memory and error correction decoding the data read from the nonvolatile memory at the time of reading.
2. Description of the Related Art
In a nonvolatile memory device storing data using a nonvolatile memory, to secure reliability of the storage data, error detection and error correction are carried out at the time of reading. For this reason, the input data is encoded for the error detection and the error correction before writing it into the nonvolatile memory.
The encoding system used in the error correction encoding includes for example Reed Solomon encoding, BCH encoding, etc. These error correction encoding systems encode the input data and generate error correction codes. The error correction codes are then stored by the nonvolatile memory. At the time of reading, the error correction encoded data is read from the nonvolatile memory. The original data is restored by decoding corresponding to the error correction encoding based on the read data.
By the above encoding and decoding, for example, even if an error occurs at the time of, for example, the writing or reading with respect to the nonvolatile memory, this error is corrected by the decoding, so the input data can be correctly restored and the reliability of the nonvolatile memory device can be enhanced.
Summarizing the problem to be solved by the invention, in the encoding and decoding using the above conventional nonvolatile memory, when the data read from the nonvolatile memory after erasure all becomes “1”, the error correction encoding bits are not all “1”. This means that an error detection/correction circuit for performing the error detection and the error correction outputs a judgment result “there is error” when reading data from the nonvolatile memory that is finished being erased.
Further, when the data is written as all “1” at the time of writing, the encoding bits for the error detection/error correction are not “1”; therefore, even bits which originally should not be written have to be written by making the error correction encoding bits “0”. Namely, when the nonvolatile memory is in a certain specific initial state, for example, an erasure state, all memory cells of the nonvolatile memory are held at a constant state, so all of the storage data of the nonvolatile memory becomes a constant value, for example “1”. In this case, when error correction decoding data is read from the nonvolatile memory, a judgment result that there is an error is obtained, so there is the disadvantage that the original state of the data stored in the nonvolatile memory can no longer be correctly represented.